package text111;

public class Solution2 {
public String replaceSpace(String s) {
		/*
		 * StringBuffer stringBuffer = new StringBuffer(s); for (int i = 0; i <
		 * stringBuffer.length(); i++) {
		 * 
		 * if(stringBuffer.charAt(i) ==' ') { stringBuffer.append("%20"); } }
		 */
		StringBuffer stringBuffer = new StringBuffer(s);
		StringBuffer str = new StringBuffer();
	
		for (int i = 0; i < stringBuffer.length(); i++) {
			if(stringBuffer.charAt(i) ==' ') {
				str.append("%20");
			}else {
				str.append(stringBuffer.charAt(i));
			}
		}
		return str.toString();
    }
}
